home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 January / macformat-033.iso / mac / Shareware City / Comms / Tricks Folder / Teaching / scripts / hello-world-04.script < prev    next >
Encoding:
Text File  |  1995-08-15  |  1.3 KB  |  51 lines  |  [TEXT/ToyS]

  1. -- define the standard HTTP header
  2. set LF to ASCII character (10)
  3. set CR to return
  4. set CRLF to CR & LF
  5. set http_10_header to "HTTP/1.0 200 OK" & CRLF & ¬
  6.     "Server: MacHTTP" & CRLF & ¬
  7.     "MIME-Version: 1.0" & CRLF & ¬
  8.     "Content-type: text/html" & CRLF & CRLF
  9.  
  10. if http_search_args = "" then
  11.     
  12.     -- http_search_args is empty; request input via ISINDEX
  13.     return http_10_header & ¬
  14.         "<html>" & ¬
  15.         "<head>" & ¬
  16.         "<title>Hello!</title>" & ¬
  17.         "<isindex>" & ¬
  18.         "</head>" & ¬
  19.         "<body>Hello! What is your name?" & ¬
  20.         "</body>" & ¬
  21.         "</html>"
  22.     
  23. else
  24.     
  25.     -- http_search_args has value; return all variables
  26.     return http_10_header & ¬
  27.         "<html>" & ¬
  28.         "<head>" & ¬
  29.         "<title>Hello!</title>" & ¬
  30.         "</head>" & ¬
  31.         "<body>Hello!" & ¬
  32.         "<p>http_search_args: " & http_search_args & ¬
  33.         "<br>path_args: " & path_args & ¬
  34.         "<br>post_args: " & post_args & ¬
  35.         "<br>method: " & method & ¬
  36.         "<br>client_address: " & client_address & ¬
  37.         "<br>username:" & username & ¬
  38.         "<br>password: " & password & ¬
  39.         "<br>from_user:" & from_user & ¬
  40.         "<br>server_name:" & server_name & ¬
  41.         "<br>server_port:" & server_port & ¬
  42.         "<br>script_name: " & script_name & ¬
  43.         "<br>content_type: " & content_type & ¬
  44.         "<br>referer: " & referer & ¬
  45.         "<br>user_agent: " & user_agent & ¬
  46.         "</body>" & ¬
  47.         "</html>"
  48.     
  49. end if
  50.  
  51.